﻿Imports System.Web.Mvc

Public Class UserController
    Inherits Controller


    Private _bo As New Business.Ita.ProElicere.Business.UserBO()


    ' GET: /User
    Function Index() As ActionResult

        Dim list As List(Of Model.Ita.ProElicere.Model.User) = _bo.SelectAll()

        Return View(list)

    End Function

    ' GET: /User/Details/5
    Function Details(ByVal id As Integer) As ActionResult

        Dim data As New Model.Ita.ProElicere.Model.User(id)

        Dim entity As Model.Ita.ProElicere.Model.User = _bo.Load(data)


        Return View(entity)
    End Function

    ' GET: /User/Create
    Function Create() As ActionResult
        Return View()
    End Function

    ' POST: /User/Create
    <HttpPost()>
    Function Create(ByVal collection As FormCollection) As ActionResult
        Try
            ' TODO: Add insert logic here

            Return RedirectToAction("Index")
        Catch
            Return View()
        End Try
    End Function

    ' GET: /User/Edit/5
    Function Edit(ByVal id As Integer) As ActionResult
        Return View()
    End Function

    ' POST: /User/Edit/5
    <HttpPost()>
    Function Edit(ByVal id As Integer, ByVal collection As FormCollection) As ActionResult
        Try
            ' TODO: Add update logic here

            Return RedirectToAction("Index")
        Catch
            Return View()
        End Try
    End Function

    ' GET: /User/Delete/5
    Function Delete(ByVal id As Integer) As ActionResult
        Return View()
    End Function

    ' POST: /User/Delete/5
    <HttpPost()>
    Function Delete(ByVal id As Integer, ByVal collection As FormCollection) As ActionResult
        Try
            ' TODO: Add delete logic here

            Return RedirectToAction("Index")
        Catch
            Return View()
        End Try
    End Function
End Class